package com.atcc.demo.util;

import com.atcc.demo.common.CommonResult;
import com.atcc.demo.common.ErrorCodeEnum;

public class ResultUtil {
	
     public static <T> CommonResult<T> returnSuccess(T data){
    	 CommonResult<T> result = new CommonResult<T>();
    	 result.setCode(ErrorCodeEnum.CODE_SUCCESS.getCode());
    	 result.setSuccess(true);
    	 result.setData(data);
    	 result.setMessage(ErrorCodeEnum.CODE_SUCCESS.getDesc());
    	 result.setStackTrace(null);
    	 return result;
     }
     
     public static <T> CommonResult<T> returnError(){
    	 CommonResult<T> result = new CommonResult<T>();
    	 result.setCode(ErrorCodeEnum.NOPHONE_ERROR.getCode());
    	 result.setMessage(ErrorCodeEnum.NOPHONE_ERROR.getDesc());
    	 return result;
     }

	
}
